package com.ynny.example08.Map;

import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class ChengshiTest {
    public static void main(String[] args) {
        Map<String, String[]> mm = Chengshi.m;
        Set shengFei = mm.keySet();// 获取省份
        for (Object o : shengFei) {
            System.out.print(o + "  ");
        }
        System.out.println();
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.print("请输入省份:");
            String sf = sc.next();


            if (!mm.containsKey(sf)) {
                System.out.println("输入错误，请重新输入");

            } else {

                System.out.println("你输入的省份是:" + sf);
                String[] cityes = (String[]) mm.get(sf);
                for (String city : cityes) {
                    System.out.print(city + " ");

                }
                break;

            }
        }
    }
}
